package com.pingancar.creditmanage.dao;

import com.pingancar.creditmanage.pojo.FeedbackPojo;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by SilverStone-WW on 2015/2/16.
 */
@Repository
public class FeedbackDaoImpl extends BaseDAO<FeedbackPojo> {
    public Long countOfFeedbacklist() {
        String hql = "select count(fd.id) from FeedbackPojo fd";

        Query q = getSession().createQuery(hql);

        return (Long)q.uniqueResult();
    }

    public List feedbackList(Integer offset, Integer len) {
        String hql = "select fd from FeedbackPojo fd";
        Query q = getSession().createQuery(hql);
        return q.setFirstResult(offset).setMaxResults(len).list();
    }
}
